$(function () {
    $(".team_detail li").mouseover(function () {
        $(this).children('span:eq(0)').addClass("team_active");
        var index = $(this).children('img').attr('data_src');
        $(this).siblings('li').children('span:eq(0)').removeClass('team_active');

        // $(this).siblings('li').children('img').attr('src','image/tdetail'+index+'n.png');

        $(this).children('img').attr('src', 'image/tdetail' + index + '.png');
        $(this).children('p').addClass('team_show');



        // $(this).children('p').eq(index-1).siblings('p').attr('style','visibility:hidden');
        $('.i_t_teamwarp img').eq(index - 1).attr('style', 'display:inline-block');
        $('.i_t_teamwarp img').eq(index - 1).siblings('img').attr('style', 'display:none');
    });

    $(".team_detail li").mouseout(function () {
        var index = $(this).children('img').attr('data_src');
        $(this).children('span:eq(0)').removeClass("team_active");
        $(this).children('img').attr('src', 'image/tdetail' + index + 'n.png');
        $(this).children('p').removeClass('team_show');
        $(this).children('p').removeClass('team_detail_active');
        $('.i_t_teamwarp img').eq(index - 1).siblings('img').attr('style', 'display:none');
        //测试
        $('body').mouseover(function (index) {
            $(".team_detail li").children('span:eq(0)').eq(index - 1).addClass("team_active");
            // $(".team_detail li").children('span:eq(0)').addClass("team_active");
            $(".team_detail li").children('span:eq(0)').eq(index - 1).siblings('span').removeClass("team_active");
        });
    });


    //轮播图
    var right = 180;
    $('.i_witness_l').click(function () {
        $('.i_picList_cardlist').attr('style', 'transform: translateX(' + right + 'px)');
        right += 180;
        if (right = 6 * -180) {
            return false;
        }
    });

    var left = -200;
    $('.i_witness_r').click(function () {
        var width = $('.i_picList_cardlist').width();
        $('.i_picList_cardlist').attr('style', 'transform: translateX(' + left + 'px)');
        left -= 200;
        console.log(left);
        if (left < width) {
            left = -200;
            return false;
        }
    });

    //详情垂询
    $('.version-ask').mouseover(function () {
        $(this).html('4000-180-000');
    });

    $('.version-ask').mouseout(function () {
        $(this).html('详情垂询');
    });

    // Sass
    $('.version-item').mouseover(function () {
        $(this).attr('style', 'transform: translateY(-15px);transition-duration: 1s');
        $(this).children('div.version-btn').attr('style', 'background :#4285f4;color: #fff;cursor: pointer;');
        $(this).children('div.version-ask').html('4000-180-000');
    });

    $('.version-item').mouseout(function () {
        $(this).attr('style', 'transform: translateY(15px);transition-duration: 1s');
        $(this).children('div.version-btn').attr('style', 'background :#fff;color: #4285f4;cursor: default;');
        $(this).children('div.version-ask').html('详情垂询');
    });

    // 免费试用按钮
    $('.d-btn').click(function () {
        layer.open({
            area: ['630px', '500px'],
            title: false,
            type: 1,
            content: $('#showInfo') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
        });
    });

    // sidebar
    $('.side-bar-content').mouseover(function () {
        $(this).addClass('active-blue');
        $(this).children('p').eq(1).addClass('active-white');
        $(this).children('p').children('i').attr('style', 'color: #fff; font-size: 25px;');
    });

    $('.side-bar-content').mouseout(function () {
        $(this).removeClass('active-blue');
        $(this).children('p').eq(1).removeClass('active-white');
        $(this).children('p').children('i').attr('style', 'color: #4285f4; font-size: 25px;');
    });

    $('#zaix').mouseover(function () {
        $('#zaixi').attr('style', 'transform: translateX(-452px);visibility: visibility;transition-duration: 0.5s');
    });

    $('#zaix').mouseout(function () {
        $('#zaixi').attr('style', 'transform: translateX(452px);visibility: hidden;transition-duration: 1s');
    });

    $('#chanp').mouseover(function () {
        $('#chanpi').attr('style', 'transform: translateX(-452px);visibility: visibility;transition-duration: 0.5s');
    });

    $('#chanp').mouseout(function () {
        $('#chanpi').attr('style', 'transform: translateX(452px);visibility: hidden;transition-duration: 1s');
    });

    $('#mianf').mouseover(function () {
        $('#mianfi').attr('style', 'transform: translateX(-452px);visibility: visibility;transition-duration: 0.5s');
    });

    $('#mianf').mouseout(function () {
        $('#mianfi').attr('style', 'transform: translateX(452px);visibility: hidden;transition-duration: 1s');
    });

    //产品页二级菜单
    $('.product-nav').children('li').mouseover(function () {
        var c = $(this).attr('data-id');
        // $("#"+c).attr('style','visibility: visible;');
        // $("#"+c).slideDown("slow");
        $("#" + c).height('180px').slideDown();

        //点击二级菜单
        $("#" + c).mouseover(function () {
            $(this).show();
            $(this).css('cursor', 'pointer');
        });

        $("#" + c).mouseout(function () {
            $(this).hide();
        });

        //二级菜单跳转
        $('.product-alert-content').children('p').click(function () {
            var maodian = $(this).html();
            if(c == 'ric'){
                $(window).attr('location', 'product.html#' + maodian);
            }else{
                $(window).attr('location', c+'.html#' + maodian);
            }
        });

    });

    $('.product-nav').children('li').mouseout(function () {
        var c = $(this).attr('data-id');
        // $("#"+c).attr('style','visibility: visible;');
        // $("#"+c).slideDown("slow");
        // $("#"+c).slideUp('slow');
        $("#" + c).hide();
    });

    // //二级菜单跳转
    // $('.product-alert-content').children('p').click(function(){
    //     var maodian = $(this).html();
    //     $(window).attr('location', 'product.html#'+maodian);
    //     // console.log(c);
    // });

});

// 展开收起
function showMore(obj, w) {
    if (w == 'fuwb') {
        $('.packge .open').attr('style', 'bottom: -100px');
        $('.packge').attr('style', 'overflow: ');
    } else {
        $('.special .open').attr('style', 'bottom: -100px');
        $('.special').attr('style', 'overflow: ');
    }
}

function toHidden(obj, w) {
    if (w == 'fuwb') {
        $('.packge .open').attr('style', 'bottom: 4px');
        $('.packge').attr('style', 'height: 329px');
        $("html,body").animate({
            scrollTop: $('#p-fuwb').offset().top
        }, 500 /*scroll实现定位滚动*/); /*让整个页面可以滚动*/
    } else {
        $('.special .open').attr('style', 'bottom: 4px');
        $('.special').attr('style', 'height: 300px');
        $("html,body").animate({
            scrollTop: $('#p-special').offset().top
        }, 500 /*scroll实现定位滚动*/); /*让整个页面可以滚动*/
    }
}

//跳转
function toIndex() {
    $(window).attr('location', 'index.html');
}

function toProduct() {
    $(window).attr('location', 'product.html');
}

function toBuy() {
    $(window).attr('location', 'buy.html');
}

function toPartner() {
    $(window).attr('location', 'partner.html');
}

